/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "ING_EGR")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "IngresoEgreso.findAll", query = "SELECT i FROM IngresoEgreso i"),
    @NamedQuery(name = "IngresoEgreso.findByIeCod", query = "SELECT i FROM IngresoEgreso i WHERE i.ieCod = :ieCod"),
    @NamedQuery(name = "IngresoEgreso.findByAbnFech", query = "SELECT i FROM IngresoEgreso i WHERE i.abnFech = :abnFech"),
    @NamedQuery(name = "IngresoEgreso.findByIeTipo", query = "SELECT i FROM IngresoEgreso i WHERE i.ieTipo = :ieTipo"),
    @NamedQuery(name = "IngresoEgreso.findByIeMont", query = "SELECT i FROM IngresoEgreso i WHERE i.ieMont = :ieMont"),
    @NamedQuery(name = "IngresoEgreso.findByIeNdoc", query = "SELECT i FROM IngresoEgreso i WHERE i.ieNdoc = :ieNdoc"),
    @NamedQuery(name = "IngresoEgreso.findByIeReferencia", query = "SELECT i FROM IngresoEgreso i WHERE i.ieReferencia = :ieReferencia"),
    @NamedQuery(name = "IngresoEgreso.findByBancId", query = "SELECT i FROM IngresoEgreso i WHERE i.bancId = :bancId"),
    @NamedQuery(name = "IngresoEgreso.findByIeFechTrans", query = "SELECT i FROM IngresoEgreso i WHERE i.ieFechTrans = :ieFechTrans")})
public class IngresoEgreso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "IE_COD")
    private Integer ieCod;
    @Basic(optional = false)
    @Column(name = "ABN_FECH")
    @Temporal(TemporalType.DATE)
    private Date abnFech;
    @Basic(optional = false)
    @Column(name = "IE_TIPO")
    private char ieTipo;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "IE_MONT")
    private Double ieMont;
    @Column(name = "IE_NDOC")
    private String ieNdoc;
    @Column(name = "IE_REFERENCIA")
    private Integer ieReferencia;
    @Column(name = "BANC_ID")
    private Short bancId;
    @Column(name = "IE_FECH_TRANS")
    @Temporal(TemporalType.DATE)
    private Date ieFechTrans;
    @JoinColumn(name = "DOCP_COD", referencedColumnName = "DOCP_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private DocumentoPago docpCod;
    @JoinColumn(name = "DEP_COD", referencedColumnName = "DEP_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Dependencia depCod;
    @JoinColumn(name = "ALU_COD", referencedColumnName = "ALU_COD")
    @ManyToOne(fetch = FetchType.LAZY)
    private Alumno aluCod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "ingresoEgreso", fetch = FetchType.LAZY)
    private List<Cancelacion> cancelacionList;

    public IngresoEgreso() {
    }

    public IngresoEgreso(Integer ieCod) {
        this.ieCod = ieCod;
    }

    public IngresoEgreso(Integer ieCod, Date abnFech, char ieTipo) {
        this.ieCod = ieCod;
        this.abnFech = abnFech;
        this.ieTipo = ieTipo;
    }

    public Integer getIeCod() {
        return ieCod;
    }

    public void setIeCod(Integer ieCod) {
        this.ieCod = ieCod;
    }

    public Date getAbnFech() {
        return abnFech;
    }

    public void setAbnFech(Date abnFech) {
        this.abnFech = abnFech;
    }

    public char getIeTipo() {
        return ieTipo;
    }

    public void setIeTipo(char ieTipo) {
        this.ieTipo = ieTipo;
    }

    public Double getIeMont() {
        return ieMont;
    }

    public void setIeMont(Double ieMont) {
        this.ieMont = ieMont;
    }

    public String getIeNdoc() {
        return ieNdoc;
    }

    public void setIeNdoc(String ieNdoc) {
        this.ieNdoc = ieNdoc;
    }

    public Integer getIeReferencia() {
        return ieReferencia;
    }

    public void setIeReferencia(Integer ieReferencia) {
        this.ieReferencia = ieReferencia;
    }

    public Short getBancId() {
        return bancId;
    }

    public void setBancId(Short bancId) {
        this.bancId = bancId;
    }

    public Date getIeFechTrans() {
        return ieFechTrans;
    }

    public void setIeFechTrans(Date ieFechTrans) {
        this.ieFechTrans = ieFechTrans;
    }

    public DocumentoPago getDocpCod() {
        return docpCod;
    }

    public void setDocpCod(DocumentoPago docpCod) {
        this.docpCod = docpCod;
    }

    public Dependencia getDepCod() {
        return depCod;
    }

    public void setDepCod(Dependencia depCod) {
        this.depCod = depCod;
    }

    public Alumno getAluCod() {
        return aluCod;
    }

    public void setAluCod(Alumno aluCod) {
        this.aluCod = aluCod;
    }

    @XmlTransient
    public List<Cancelacion> getCancelacionList() {
        return cancelacionList;
    }

    public void setCancelacionList(List<Cancelacion> cancelacionList) {
        this.cancelacionList = cancelacionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ieCod != null ? ieCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof IngresoEgreso)) {
            return false;
        }
        IngresoEgreso other = (IngresoEgreso) object;
        if ((this.ieCod == null && other.ieCod != null) || (this.ieCod != null && !this.ieCod.equals(other.ieCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.IngresoEgreso[ ieCod=" + ieCod + " ]";
    }
    
}
